package com.augurit.gzcgwsp.webservice;

import java.net.URL;

import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.log4j.Logger;

/**
 * 客户端调用类
 * @version 1.0 
 * @since 2011-5-11
 */
public class WSClient {
	private static Logger log=Logger.getLogger(WSClient.class);
	String url = "http://127.0.0.1:8080/gzcgw/services/IKingdomDataService";


	public String  getData() {
			String result="";
			String pageNo="1";
			String pageSize="100";
			String targetEendPoint = url;    
			System.out.println(url);
			try {
			Service  service = new Service();   
			Call call = (Call) service.createCall(); 
			call.setTargetEndpointAddress(new URL(targetEendPoint));
			call.setUsername("test");
			call.setPassword("test");


            call.setOperationName(new QName(targetEendPoint, "getRqjyxkDatas"));
            call.addParameter( "pageNo", org.apache.axis.Constants.XSD_STRING, ParameterMode.IN); 
            call.addParameter( "pageSize", org.apache.axis.Constants.XSD_STRING, ParameterMode.IN); 
			call.setReturnType(org.apache.axis.Constants.XSD_STRING);
			result =(String) call.invoke( new Object[] {pageNo,pageSize});
			} catch (Exception e) {
			e.printStackTrace();
		}          
	     return result;    
	}
	
    public static void main(String[] args) throws Exception{
    	WSClient client=new WSClient();
    	String vid=client.getData();
    	System.out.print(vid);
    }
}
